package cn.iocoder.boot.controller.admin;

import cn.iocoder.boot.entity.ComponentPrice;
import cn.iocoder.boot.service.ComponentPriceService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 组件价格Controller
 *
 * @author 芋道源码
 */
@RestController
@RequestMapping("/componentPrice")
public class ComponentPriceController {

    @Autowired
    private ComponentPriceService componentPriceService;

    @PostMapping("/create")
    public CommonResult<Boolean> createComponentPrice(@RequestBody ComponentPrice componentPrice) {
        return componentPriceService.createComponentPrice(componentPrice);
    }

    @PostMapping("/update")
    public CommonResult<Boolean> updateComponentPrice(@RequestBody ComponentPrice componentPrice) {
        return componentPriceService.updateComponentPrice(componentPrice);
    }

    @PostMapping("/delete/{id}")
    public CommonResult<Boolean> deleteComponentPrice(@PathVariable Long id) {
        return componentPriceService.deleteComponentPrice(id);
    }

    @GetMapping("/get/{id}")
    public CommonResult<ComponentPrice> getComponentPrice(@PathVariable Long id) {
        return componentPriceService.getComponentPrice(id);
    }

    @GetMapping("/list")
    public CommonResult<List<ComponentPrice>> listComponentPrices(@RequestParam(required = false) List<Long> id,@PathVariable String  currency) {
        return componentPriceService.listComponentPrices( id,currency);
    }
}
